import babel from '@rollup/plugin-babel'
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'

export default {
  input: "src/index.js",
  output: {
    file: "dist/index.js",
    format: "iife",//用cdn，需要挂载到全局，需要改成iife,立即函数
    // 挂载到全局变量
    globals: {
      lodash: "_", // 以 _ 方式挂载
      jquery: "$"
    },

  },
  // 告诉 Rollup jquery 是外部依赖(external)，jquery 模块的 ID 为全局变量 $(globals)：
  external:['lodash','jquery'],
  plugins: [babel(), resolve(), commonjs()]
}
